﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBLayer;

namespace EngineLayer.Services
{
    using EngineLayer.Model;
    public enum ItemRights
    {
        Administrador = 2,
        Catalogos = 4,
        Caja = 8,
        Reportes = 16,
        Comunicados = 32,
        FullAccess = 62,
    }
   
    public class UserRights : DBEntities
    {
        public virtual int TotalRights { get; set; }

        public bool HaveRightItem(ItemRights ItemRigth)
        {
            int result = ((int)ItemRigth & TotalRights);
            return result > 0;
        }
        public bool ActivateFranchise()
        {
            return database.Companies.OfType<FranChise>().Count() > 0;
        }
    }
}
